package com.ys.erp.stage_mall_service.controller;

import com.ys.erp.framework.annotation.CheckEmpLogin;
import com.ys.erp.framework.annotation.ResponseResult;
import com.ys.erp.framework.annotation.StageLoginEmp;
import com.ys.erp.framework.bean.dto.StageEmpDTO;
import com.ys.erp.framework.response.PageDTO;
import com.ys.erp.stage_mall_service.bean.condition.OrderCondition;
import com.ys.erp.stage_mall_service.bean.vo.OrderDetailVO;
import com.ys.erp.stage_mall_service.bean.vo.OrderVO;
import com.ys.erp.stage_mall_service.service.OrderService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @author lwj
 * @date 2025/5/19
 */
@ResponseResult
@RestController
@RequiredArgsConstructor
@RequestMapping("/manage/mall/order")
@Tag(name = "订单相关接口", description = "订单相关接口")
public class OrderController {

    private final OrderService orderService;

    @Operation(summary = "分页订单", description = "分页订单")
    @CheckEmpLogin
    @PostMapping("/pageOrder")
    public PageDTO<OrderVO> pageOrder(@RequestBody @Valid OrderCondition.PageOrderCon con,
                                      @StageLoginEmp StageEmpDTO empDTO) {
        return orderService.pageOrder(con);
    }

    @GetMapping("/getOrderDetail")
    @CheckEmpLogin
    @Operation(summary = "获取订单详情", description = "获取订单详情")
    public OrderDetailVO getOrderDetail(@RequestParam(value = "orderId") Long orderId,
                                        @StageLoginEmp StageEmpDTO empDTO) {
        return orderService.getOrderDetail(orderId);
    }

}
